import {
  defineAsyncComponent
} from "@vue/runtime-core";

export default function registerGolbalComponents(app) {
  const components =
    import.meta.glob('./*.vue')

  for (const path in components) {
    const componentName = path.split('/').pop().replace(/.\w+$/, '')
    app.component(componentName, defineAsyncComponent(components[path]))
  }
}

/**
 * 参考文献：
 * vue全局公共组件自动引入并注册，开发效率直接起飞！
 *      https://blog.csdn.net/weixin_46769087/article/details/140286647
 * 
 */